<?php
ini_set ( 'error_reporting', E_ALL );
ini_set ( 'display_errors', '1' );

require_once 'newsfeedManager.class.php';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>newsfeed</title>
<script type="text/javascript" src="jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jquery/jquery.marquee.js"></script>
<link href="newsfeedManager.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php

try {

	// Construction
  $aNewsFeedParams = array( 'sNewsXmlFilePath' => null, 'iSpacePixels' => null, 'sTagType' => null, 'sTagId' => null, 'sWhitePixelUrl' => null, 'bJavascript' => true, 'aMarqueeAttributes' => null );  // Not mandatory parameter
  $aNewsFeedManagerParams = array( 'oNewsFeed' => new newsfeed($aNewsFeedParams), 'sFormAction' => '#', 'sDivId' => 'newfeedForm' );  // Only oNewsFeed is mandatory 
  $oNewsFeedManager = new newsfeedManager( $aNewsFeedManagerParams );
  
  // Saving (posted) items to xml file
  if ( isset($_POST['aItems']) && !empty($_POST['aItems']) ) {
    $oNewsFeedManager->getNewsFeed()->saveItems($_POST['aItems']);
  }
  
  // Adding live item
  $oNewsFeedManager->getNewsFeed()->addItem(array('span'=>array('text'=>date('Y-m-d h:i:s'),'style'=>'font-weight:bold')));
  
  // Displaying
  $oNewsFeedManager->getNewsFeed()->getTag(1);
  //$oNewsFeedManager->getNewsFeed()->getItems(1);
	//$oNewsFeedManager->getNewsFeed()->getXml(1);
	$oNewsFeedManager->getForm(1);
	  
} catch ( Exception $e ) {

	echo('<p>Error ' . $e->getCode() . ': ' . $e->getMessage() . "</p>\n");
	
}

?>

</body>
</html>